package job;

public class Day2Job04 {
    public static void main(String[] args) {
        int a = 1000, b = 2000, c = 3000;
        int d, e, f;
        d = 4000;
        e = 5000;
        f = 6000;
        System.out.println(a + b + c + d + e + f);
        int g = 7;
        int h = g + 10;
        System.out.println(h);
        g += 10;
        System.out.println(g);
        //int j;//编译错误,没有初始化
        //int m = 10000000000000000;编译错误,超出取值范围
        //int a*3 =5;编译错误,不能有特殊的符号
        //int 1aaa;编译错误,声明变量不能以数字开头
        //int aaa=3.14编译错误,左右类型不一致

        int aa = 25;
        //int b = 10000000000; //编译错误，100亿默认为int类型，但超出int范围了
        System.out.println(5 / 2); //2
        System.out.println(2 / 5); //0
        System.out.println(5 / 2.0); //2.5
        int cc = 2147483647; //int的最大值
        cc = cc + 1;
        System.out.println(cc);

        //2)long:长整型，8个字节，很大很大很大
        long aaa = 25L; //25L为长整型直接量，默认为long型
        //long b = 10000000000; //编译错误，100亿默认为int类型，但超出int范围了
        long ccc = 10000000000L; //100亿L为长整型直接量
        long dd = 1000000000 * 2 * 10L;
        System.out.println(d); //200亿
        //long e = 1000000000*3*10L;
        System.out.println(e); //不是300亿
        long ff = 1000000000L * 3 * 10; //运算若有可能溢出，建议在第1个数字后加L
        System.out.println(ff); //300亿

        double a1 = 3.14159;
        float b1 = 3.14159F;
        double c1 = 3.0, d1 = 2.9;
        System.out.println(c1 - d1);

        boolean a2 = true;
        boolean b2 = false;

        char c2 = '女'; //字符女
        char c3 = 'f'; //字符f
        char c4 = '6'; //字符6
        char c5 = '*'; //字符*
        //char c6 = 女; //编译错误，字符型直接量必须放在单引号中
        //char c7 = ''; //编译错误，必须有字符
        //char c8 = '女性'; //编译错误，只能有一个字符

        int aw5 = 5;
        long b3 = aw5; //自动类型转换
        int c9 = (int) b3; //强制类型转换
        long d3 = 5; //自动类型转换
        double e2 = 5; //自动类型转换
        long f1 = 10000000000L;
        int g1 = (int) f1;
        System.out.println(g1); //1410065408，强转有可能发生溢出
        double h1 = 25.987;
        int i = (int) h1;
        System.out.println(i);

        byte b4 = 5;
        byte b5 = 6;
        byte b6 = (byte) (b4 + b5);
        System.out.println(2 + 2); //4
        System.out.println(2 + '2'); //52，2加上'2'的码50
        System.out.println('2' + '2');
        System.out.println(b6);
    }
}
